package com.fengmi.controller;

import com.fengmi.dto.SearchDTO;
import com.fengmi.entity.ESGoods;
import com.fengmi.goods.MallGoods;
import com.fengmi.service.ISearchService;
import com.fengmi.vo.PageResultVO;
import com.fengmi.vo.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 作者：铁蛋
 * 时间：2021/10/18 19:13
 * 描述：永无Bug
 */
@RestController
@RequestMapping("search")
public class SearchController {
    @Autowired
    private ISearchService searchService;
    @RequestMapping("init")
    public ResultVO init(){
        return searchService.goods2es();
    }
    @RequestMapping("goods")
    public PageResultVO<ESGoods> goods(@RequestBody SearchDTO searchDTO){
        return searchService.search(searchDTO);
    }
    @RequestMapping("goodsToes")
    public ResultVO goodsToes(@RequestBody MallGoods goods){
        return searchService.goodsToes(goods);
    }
}
